<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateTicketsTable extends Migration
{

    protected $tableName = 'tickets';

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create($this->tableName, function (Blueprint $table) {
            $table->increments('id');

            $table->integer('user_id')->comment('用户ID');
            $table->integer('assigned_admin_id')->default(0);
            $table->integer('submitted_admin_id');
            $table->string('subject', 256);
            $table->string('remark', 256);
            $table->timestamp('contact_at')->nullable();

            $table->tinyInteger('status');
            $table->tinyInteger('type');

            $table->timestamps();
            $table->softDeletes();

        });
        DB::statement("ALTER TABLE `$this->tableName` comment '任务表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists($this->tableName);
    }
}
